
var record = 6;//\u6BCF\u9875\u663E\u793A\u591A\u5C11\u6761\u8BB0\u5F55
var count = 1;//\u8BB0\u5F55\u603B\u6570
var pageTotal = 1//\u603B\u9875\u6570
var pagenum = 1;//\u5C06\u8981\u663E\u793A\u7684\u9875\u7801

//\u91CD\u65B0\u6574\u7406\u5F53\u524D\u9875\u7801\uFF0C\u5982\u679C\u9875\u9762\u5C0F\u4E8E1\uFF0C\u5219\u8D4B\u503C\u4E3A1\uFF0C\u5982\u679C\u5927\u4E8E\u603B\u9875\u6570\uFF0C\u5219\u7B49\u4E8E\u603B\u9875\u6570
coordinatePagenum(pagenum);

//\u6839\u636E\u5F53\u524D\u8981\u663E\u793A\u7684\u9875\u7801\u53D6\u5F97\u5F53\u524D\u9762\u91CC\u7B2C\u4E00\u6761\u8BB0\u5F55\u7684\u53F7\u7801
var pageBegin = (record*(pagenum-1)+1)|0;

//\u6839\u636E\u5F53\u524D\u8981\u663E\u793A\u7684\u9875\u7801\u53D6\u5F97\u5F53\u524D\u9762\u91CC\u6700\u540E\u4E00\u6761\u8BB0\u5F55\u7684\u53F7\u7801
var pageEnd = record*pagenum;

function initdata(pagenum)
{
var list_obj = document.getElementById("list").getElementsByTagName("li");
count=list_obj.length; 
pageTotal = ((count+record-1)/record)|0;//\u603B\u9875\u6570

showhiddenRecord(pagenum)
}
function showhiddenRecord(pagenum){

if(pagenum<=1){

document.getElementById("thePrePage").innerHTML="\u4E0A\u4E00\u9875";
}else{

document.getElementById("thePrePage").innerHTML="<a href=\"javascript:prePage()\">\u4E0A\u4E00\u9875</a>";
}
if(pagenum>=pageTotal){
document.getElementById("theNextPage").innerHTML="\u4E0B\u4E00\u9875";

}else{
document.getElementById("theNextPage").innerHTML="<a href=\"javascript:nextPage()\">\u4E0B\u4E00\u9875</a>";

}

//\u6839\u636E\u5F53\u524D\u8981\u663E\u793A\u7684\u9875\u7801\u53D6\u5F97\u5F53\u524D\u9762\u91CC\u7B2C\u4E00\u6761\u8BB0\u5F55\u7684\u53F7\u7801
pageBegin = (record*(pagenum-1)+1)|0;

//\u6839\u636E\u5F53\u524D\u8981\u663E\u793A\u7684\u9875\u7801\u53D6\u5F97\u5F53\u524D\u9762\u91CC\u6700\u540E\u4E00\u6761\u8BB0\u5F55\u7684\u53F7\u7801
pageEnd = record*pagenum;
list_obj = document.getElementById("list").getElementsByTagName("li");
for(var i=0;i<list_obj.length;i++){
if(i>=pageBegin-1 && i<=pageEnd-1){
   list_obj[i].style.display="";
}else{
   list_obj[i].style.display="none";
}
}

}

function firstPage(){
pagenum=1;
showhiddenRecord(pagenum);
}

function lastPage(){
pagenum=pageTotal
showhiddenRecord(pageTotal);
}

//\u91CD\u65B0\u6574\u7406\u5F53\u524D\u9875\u7801\uFF0C\u5982\u679C\u9875\u9762\u5C0F\u4E8E1\uFF0C\u5219\u8D4B\u503C\u4E3A1\uFF0C\u5982\u679C\u5927\u4E8E\u603B\u9875\u6570\uFF0C\u5219\u7B49\u4E8E\u603B\u9875\u6570
function coordinatePagenum(num){
if(num<1){
num="1";
}else if(num>pageTotal){
num=pageTotal;
}
}

function prePage(){
pagenum--;
coordinatePagenum(pagenum);
showhiddenRecord(pagenum);
}

function nextPage(){
pagenum++;
coordinatePagenum(pagenum);
showhiddenRecord(pagenum);
}

function gotoPage(num){
pagenum=num
coordinatePagenum(pagenum);
showhiddenRecord(num);
}
